home *** CD-ROM | disk | FTP | other *** search
- (*===========================================================================*)
- (* Action command processor *)
- (* *)
- (* Copyright 1990, 1991, 1992 by H. Roy Engehausen. All rights reserved. *)
- (* *)
- (*===========================================================================*)
-
- (*===========================================================================*)
- (* Free action *)
- (*===========================================================================*)
-
- PROCEDURE free_action;
-
- VAR
- a_type : action_msg_type;
- i : WORD;
- next_msg_action : action_msg_ptr;
- next_search : search_block_ptr;
- this_search : search_block_ptr;
-
- CONST
- action_msg_short1 = action_msg_change OR action_msg_invert;
- action_msg_short2 = action_msg_deny OR action_msg_invert;
-
- action_msg_0 = action_msg_hold
- OR action_msg_review
- OR action_msg_reject
- OR action_msg_old ;
-
- action_msg_1 = action_msg_distr;
-
- action_msg_2 = action_msg_deny;
-
- action_msg_invert = $01; (* Negate the test *)
-
- LABEL free_action_now;
-
- BEGIN;
-
- {$IFDEF DEBUG1}
- WRITELN('Free action start');
- DELAY(1000);
- {$ENDIF}
-
- (*-----------------------------------------------------------------------*)
- (* Loop thru all the actions *)
- (*-----------------------------------------------------------------------*)
-
- WHILE first_msg_action <> NIL DO
- BEGIN;
-
- {$IFDEF POINT_CHK}
- test_pointer(first_msg_action);
- {$ENDIF}
-
- (*-------------------------------------------------------------------*)
- (* Chain to the next action *)
- (*-------------------------------------------------------------------*)
-
- next_msg_action := first_msg_action^.next_action;
-
- (*-------------------------------------------------------------------*)
- (* Discard the search blocks if any *)
- (*-------------------------------------------------------------------*)
-
- next_search := first_msg_action^.action_srch;
- WHILE next_search <> NIL DO
- BEGIN;
-
- {$IFDEF POINT_CHK}
- test_pointer(next_search);
- {$ENDIF}
-
- this_search := next_search;
- next_search := this_search^.search_next;
-
- FREEMEM(this_search, length_search_block(this_search));
-
- END;
-
- (*-------------------------------------------------------------------*)
- (* Get the type somewhere handy *)
- (*-------------------------------------------------------------------*)
-
- a_type := first_msg_action^.action_type;
-
- (*-------------------------------------------------------------------*)
- (* Handle FORMAT0. This includes both CHANGE_ADR and DENY_NEW_MSG *)
- (* with the NO *)
- (*-------------------------------------------------------------------*)
-
- IF ((a_type AND action_msg_0) <> 0)
- OR ((a_type AND action_msg_short1) = action_msg_short1)
- OR ((a_type AND action_msg_short2) = action_msg_short2) THEN
- BEGIN
- i := action_msg_overhead + WORD(1)
- + LENGTH(first_msg_action^.action_info);
- GOTO free_action_now;
- END;
-
- (*-------------------------------------------------------------------*)
- (* Handle CHANGE_ADR *)
- (*-------------------------------------------------------------------*)
-
- IF a_type = action_msg_change THEN
- BEGIN;
- i := 1 + LENGTH(first_msg_action^.action_info);
- INC(i, ORD(first_msg_action^.action_info[i]) + 1);
- INC(i, ORD(first_msg_action^.action_info[i]) + 1);
- INC(i, ORD(first_msg_action^.action_info[i])
- + WORD(1) + action_msg_overhead);
- GOTO free_action_now;
- END;
-
- (*-------------------------------------------------------------------*)
- (* Handle Format 1 *)
- (*-------------------------------------------------------------------*)
-
- IF a_type = action_msg_1 THEN
- BEGIN;
- i := 1 + LENGTH(first_msg_action^.action_info);
- INC(i, ORD(first_msg_action^.action_info[i])
- + 1 + action_msg_overhead);
- GOTO free_action_now;
- END;
-
- (*-------------------------------------------------------------------*)
- (* Handle Format 2 *)
- (*-------------------------------------------------------------------*)
-
- IF a_type = action_msg_2 THEN
- BEGIN;
- i := 1 + WORD(LENGTH(first_msg_action^.action_info))
- + SIZEOF(WORD) + action_msg_overhead;
- GOTO free_action_now;
- END;
-
- (*-------------------------------------------------------------------*)
- (* If we reach here, the action stuff is screwed up *)
- (*-------------------------------------------------------------------*)
-
- WRITELN('Action free failure for code ', a_type);
- RUNERROR(action_error);
-
- (*-------------------------------------------------------------------*)
- (* Free the thing now *)
- (*-------------------------------------------------------------------*)
-
- free_action_now:
-
- {$IFDEF DEBUG3}
- trace_data('ACF', i , first_msg_action, '');
- {$ENDIF}
-
- FREEMEM(first_msg_action, i);
-
- {$IFDEF FREE_CHECK}
- test_free_list;
- {$ENDIF}
-
- (*-------------------------------------------------------------------*)
- (* Point to next action *)
- (*-------------------------------------------------------------------*)
-
- first_msg_action := next_msg_action;
-
- END; (*----- End of loop thru all the actions -------------------------*)
-
- {$IFDEF DEBUG1}
- WRITELN('Free action end');
- DELAY(1000);
- {$ENDIF}
-
- END;